<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务，帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2024 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件，不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);

namespace app\store\controller\jia;

use app\store\controller\Controller;
use app\store\model\jia\Feedback as AreaModel;
use cores\exception\BaseException;
use think\response\Json;

use think\facade\Db;

/**
 * 商品管理控制器
 * Class Goods
 * @package app\store\controller
 */
class Feedback extends Controller {
	/**
	 * 商品列表
	 * @return Json
	 * @throws \think\db\exception\DbException
	 */
	public function list(): Json {
		// 获取列表记录
		$model = new AreaModel;
		$param = $this->request->param();

		$list = $model->getList($param);
		return $this->renderSuccess(compact('list'));
	}




	

	
	/**
	 * 删除商品
	 * @param array $buildIds
	 * @return Json
	 */
	public function delete(int $feedbackId): Json {

		$model = new AreaModel;
		if (!$model->remove($feedbackId)) {
			return $this->renderError($model->getError() ?: '删除失败');
		}
		return $this->renderSuccess('删除成功');
	}

	  public function edit(int $feedbackId): Json
    {
        // 文章详情
        $model = AreaModel::detail($feedbackId);
        // 更新记录
        if ($model->edit($this->postForm())) {
            return $this->renderSuccess('更新成功');
        }
        return $this->renderError($model->getError() ?: '更新失败');
    }
}
